<?php

namespace Bigspender\DefaultBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Bigspender\DefaultBundle\Entity\User;

/**
*
* @ORM\Entity
* @ORM\Table(name="movimentation")
*/
class Movimentation extends Row implements  \Serializable
{
	/**
	* @ORM\Column(type="boolean")
	*/
	private $inflow;

	/**
	* @ORM\Column(type="float")
	*/
	private $value;

	/**
	* @ORM\Column(type="text")
	*/
	private $description;

	/**
	* @ORM\Column(type="date")
	*/
	private $reference;

	/**
	* @ORM\ManyToOne(targetEntity="User")
	* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
	**/
	private $user;

	public function __construct()
	{
		$this->value = null;
		$this->inflow = true;
		$this->description = null;
		$this->reference = new \DateTime();
		parent::__construct();
	}

	public function getInflow()
	{
		return $this->inflow;
	}

	public function getValue()
	{
		return $this->value;
	}


	public function getDescription()
	{
		return $this->description;
	}

	public function getReference()
	{
		return $this->reference;
	}

	public function setInflow($inflow)
	{
		$this->inflow = $inflow;
	}

	public function setDescription($description)
	{
		$this->description = $description;
	}

	public function setValue($value)
	{
		$this->value = $value;
	}

	public function setUser($user)
	{
		$this->user = $user;
	}

	public function setReference($reference)
	{
		$this->reference = $reference;
	}

	public function serialize()
	{
		return serialize(
			array(
				$this->id,
				$this->inflow,
				$this->value,
				$this->description,
				$this->reference
			)
		);
	}

	public function unserialize($serialized)
	{
		list (
			$this->id,
			$this->inflow,
			$this->value,
			$this->description,
			$this->reference,
		) = unserialize($serialized);
	}
}